package router_group

import router_group.Messages._

/**
 * @Description: TODO
 * @Author: DJJ
 * @Date: 2019/12/16 10:59
 */
object LoadBalancerDemo extends App {
  /**
   * 先生成CalcRouter ,根据配置文件 hashing中的 /frontend/calcRouter  routees.paths = ["/user/calculator"] 全部转发到 CalcFuctions
   */
  Calculator.create(2551)   //seed-node
  Calculator.create(0)      //backend node
  Calculator.create(0)
  Calculator.create(0)
  Calculator.create(0)
  Calculator.create(0)

  Thread.sleep(2000)

  FrontEnd.create


  Thread.sleep(2000)

  val router = FrontEnd.getRouter

  router ! Add(10,3)
  router ! Mul(3,7)
  router ! Div(8,2)
  router ! Sub(45, 3)
  router ! Div(8,0)
  Thread.sleep(2000)

  router ! Add(10,3)
  router ! Mul(3,7)
  router ! Div(8,2)
  router ! Sub(45, 3)
  router ! Sub(66, 6)
  router ! Div(8,0)

}
